package com.example.shop.controller;

import com.example.shop.utils.TokenUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
/**
 * 验证token
 */
public class CheckTokenController {
    @RequestMapping("/checkToken")
    public Boolean checkToken(HttpServletRequest request) {
        String token = request.getHeader("token");
        System.err.println("token:" + token);
        System.err.println(TokenUtil.checkToken(token));
        return TokenUtil.checkToken(token);
    }
}
